bitkeeper revision 1.353 (3f13c7d5NDWHAyq2VYrx7Mqs7QYIfQ)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Tue, 15 Jul 2003 09:22:29 +0000 (09:22 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Tue, 15 Jul 2003 09:22:29 +0000 (09:22 +0000)
vga.h, keyboard.h, setup.c, ioport.c:
  Cleanups.

xenolinux-2.4.21-sparse/arch/xeno/kernel/ioport.c
xenolinux-2.4.21-sparse/arch/xeno/kernel/setup.c
xenolinux-2.4.21-sparse/include/asm-xeno/keyboard.h
xenolinux-2.4.21-sparse/include/asm-xeno/vga.h

index 2dd89e4a11a63c4de32531ae93b78fe6cd8fbcdf..76c412883f74e109abab2811688e54000392e971 100644 (file)
@@ -6,15 +6,17 @@
 #include <asm/hypervisor-ifs/dom0_ops.h>
 
 
-asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
+asmlinkage int sys_iopl(unsigned int new_io_pl)
 {
-    unsigned int new_io_pl = (turn_on)?3:0;
     unsigned int old_io_pl = current->thread.io_pl;
     dom0_op_t op;
 
     if ( !(start_info.flags & SIF_PRIVILEGED) )
         return -EPERM;
 
+    if ( new_io_pl > 3 )
+        return -EINVAL;
+
     /* Need "raw I/O" privileges for direct port access. */
     if ( (new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO) )
         return -EPERM;
@@ -23,8 +25,6 @@ asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
     if ( (new_io_pl == 0) && (start_info.flags & SIF_PRIVILEGED) )
         new_io_pl = 1;
 
-    printk("ioperm not properly supported - set iopl to %d\n",new_io_pl);
-
     /* Change our version of the privilege levels. */
     current->thread.io_pl = new_io_pl;
 
@@ -38,35 +38,11 @@ asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
 }
 
 
-asmlinkage int sys_iopl(unsigned long unused)
+asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
 {
-    struct pt_regs *regs = (struct pt_regs *)&unused;
-    unsigned int new_io_pl = regs->ebx;
-    unsigned int old_io_pl = current->thread.io_pl;
-    dom0_op_t op;
-
-    if ( !(start_info.flags & SIF_PRIVILEGED) )
-        return -EPERM;
-
-    if ( new_io_pl > 3 )
-        return -EINVAL;
-
-    /* Need "raw I/O" privileges for direct port access. */
-    if ( (new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO) )
-        return -EPERM;
-
-    /* Maintain OS privileges even if user attempts to relinquish them. */
-    if ( (new_io_pl == 0) && (start_info.flags & SIF_PRIVILEGED) )
-        new_io_pl = 1;
-
-    /* Change our version of the privilege levels. */
-    current->thread.io_pl = new_io_pl;
+    unsigned int new_io_pl = turn_on ? 3 : 0;
+    printk("ioperm not fully supported - set iopl to %d\n", new_io_pl);
+    return sys_iopl(new_io_pl);
+}
 
-    /* Force the change at ring 0. */
-    op.cmd           = DOM0_IOPL;
-    op.u.iopl.domain = start_info.dom_id;
-    op.u.iopl.iopl   = new_io_pl;
-    HYPERVISOR_dom0_op(&op);
 
-    return 0;
-}
index 51dbe125b0d8f8e36e030484910d14810a3ab4c3..1fe945976e73144cc2af203d280b9676677b593a 100644 (file)
@@ -166,7 +166,8 @@ void __init setup_arch(char **cmdline_p)
     ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
     memset(&drive_info, 0, sizeof(drive_info));
     memset(&screen_info, 0, sizeof(screen_info));
-    // this is drawn from a dump from vgacon:startup in standard linux
+    
+    /* This is drawn from a dump from vgacon:startup in standard Linux. */
     screen_info.orig_video_mode = 3; 
     screen_info.orig_video_isVGA = 1;
     screen_info.orig_video_lines = 25;
@@ -321,7 +322,7 @@ void __init setup_arch(char **cmdline_p)
         if( !(start_info.flags & SIF_PRIVILEGED) )
             panic("Xen granted us console access but not privileged status");
 
-#ifdef CONFIG_VT
+#if defined(CONFIG_VT)
 #if defined(CONFIG_VGA_CONSOLE)
         conswitchp = &vga_con;
 #elif defined(CONFIG_DUMMY_CONSOLE)
index e8a3905b7bbdc3ea94804e040a0378c9fb33201e..edbd4e3f944b97de8b91bc3da377d58e365692fb 100644 (file)
@@ -56,32 +56,24 @@ extern unsigned char pckbd_sysrq_xlate[128];
 
 static inline int xen_kbd_controller_present ()
 {
-       if( start_info.flags & SIF_CONSOLE )
-               {
-               printk("Enable keyboard\n");
-               return 1;
-               }
-       else
-               return 0;
+    return start_info.flags & SIF_CONSOLE;
 }
 
 /* resource allocation */
 #define kbd_request_region() do { } while (0)
 #define kbd_request_irq(handler) request_irq(_EVENT_KBD, handler, 0, "PS/2 kbd", NULL)
 
-// could implement these with command to xen to filter mouse stuff...
+/* could implement these with command to xen to filter mouse stuff... */
 #define aux_request_irq(hand, dev_id) 0
 #define aux_free_irq(dev_id) do { } while(0)
 
 /* Some stoneage hardware needs delays after some operations.  */
 #define kbd_pause() do { } while(0)
 
-
 static unsigned char kbd_current_scancode = 0;
 
 static unsigned char kbd_read_input(void) 
 {
-  //xprintk("kbd_read_input: returning scancode 0x%2x\n", kbd_current_scancode);
   return kbd_current_scancode;
 }
 
@@ -89,13 +81,12 @@ static unsigned char kbd_read_status(void)
 {
   long res;
   res = HYPERVISOR_kbd_op(KBD_OP_READ,0);
-  if(res<0) {
-    //printk("kbd_read_status: error from hypervisor: %d", res);
+  if ( res<0 ) 
+  {
     kbd_current_scancode = 0;
-    return 0; // error with our request - wrong domain?
+    return 0; /* error with our request - wrong domain? */
   }
   kbd_current_scancode = KBD_CODE_SCANCODE(res);
-  //printk("kbd_read_status: returning status 0x%2x\n", KBD_CODE_STATUS(res));
   return KBD_CODE_STATUS(res);
 }
 
index 7d25414050acc9acfcf4ef63555b89392d20321d..fb3605e55e6269abe57a6571f39905868b7a0740 100644 (file)
 
 extern unsigned char *vgacon_mmap;
 
-
 static unsigned long VGA_MAP_MEM(unsigned long x)
 {
-
-       if( vgacon_mmap == NULL )
-       {
-               /* This is our first time in this function. This whole thing
-               is a rather grim hack. We know we're going to get asked 
-               to map a 32KB region between 0xb0000 and 0xb8000 because
-               that's what VGAs are. We used the boot time permanent 
-               fixed map region, and map it to machine pages.
-               */
-
-               if( x != 0xb8000 )
-               {
-                       printk("Argghh! VGA Console is weird. 1:%08lx\n",x);
-                       BUG();  
-               }
-
-               vgacon_mmap = (unsigned char*) bt_ioremap( 0xb8000, 32*1024 );
-//xprintk("VGA_MAP_MEM(%08x) first. return %p\n",x,vgacon_mmap);
-               return (unsigned long) vgacon_mmap;
-       }
-       else
-       {
-               if( x != 0xc0000 )
-                {
-                        printk("Argghh! VGA Console is weird. 2:%08lx\n",x);  
-                        BUG();
-                }
-//xprintk("VGA_MAP_MEM(%08x) second. return %p\n",x,(unsigned long) vgacon_mmap+0x8000);
-
-               return (unsigned long) vgacon_mmap + 0x8000;
-
-       }
-       return 0;
+    if( vgacon_mmap == NULL )
+    {
+        /* This is our first time in this function. This whole thing
+           is a rather grim hack. We know we're going to get asked 
+           to map a 32KB region between 0xb0000 and 0xb8000 because
+           that's what VGAs are. We used the boot time permanent 
+           fixed map region, and map it to machine pages.
+        */
+        if( x != 0xb8000 )
+            panic("Argghh! VGA Console is weird. 1:%08lx\n",x);
+
+        vgacon_mmap = (unsigned char*) bt_ioremap( 0xb8000, 32*1024 );
+        return (unsigned long) vgacon_mmap;
+    }
+    else
+    {
+        if( x != 0xc0000 )
+            panic("Argghh! VGA Console is weird. 2:%08lx\n",x);  
+
+        return (unsigned long) vgacon_mmap + 0x8000;
+    }
+    return 0;
 }
 
 static inline unsigned char vga_readb(unsigned char * x) { return (*(x)); }